﻿using System.Reflection;
using Autofac;
using Module = Autofac.Module;

namespace WebServer.Config;

public class AutofacModuleRegister : Module 
{
    /// <summary>
    /// 重写Autofac管道Load方法,在这里注册注入
    /// </summary>
    /// <param name="builder"></param>
    protected override void Load(ContainerBuilder builder)
    {
        Assembly interfaceAssembly = Assembly.Load("Interface");
        Assembly serviceAssembly = Assembly.Load("Service");
        builder.RegisterAssemblyTypes(interfaceAssembly, serviceAssembly).AsImplementedInterfaces();
    }
    
}